package com.allqj.sfx.ddd.member.application.service;

import com.allqj.sfx.application.TableHeaderApplicationService;
import com.allqj.sfx.application.dto.TableColumnDTO;
import com.allqj.sfx.domain.enums.PageEnum;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

/**
 * @author sjw
 * @className AdminDeptApplicationService
 * @date 2022/7/28 18:14
 * @description: 业务编排
 * 依赖domain层的service&repository
 * 会员管理-管理端-部门管理
 */
@Component
public class AdminDeptApplicationService {
    private final TableHeaderApplicationService tableHeaderApplicationService;

    public AdminDeptApplicationService(TableHeaderApplicationService tableHeaderApplicationService) {
        this.tableHeaderApplicationService = tableHeaderApplicationService;
    }

    public List<TableColumnDTO> pageHeader() {
        List<TableColumnDTO> headers = tableHeaderApplicationService.header(PageEnum.MEMBER_ADMIN_DEPT);
        return Optional.ofNullable(headers).orElse(new ArrayList<>());
    }
}
